Use word wrapping by default, and center multiline labels. (#318763, Ross
authorMatthias Clasen <mclasen@redhat.com>
Fri, 29 Dec 2006 04:39:51 +0000 (04:39 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 29 Dec 2006 04:39:51 +0000 (04:39 +0000)
2006-12-28  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkiconview.c: Use word wrapping by default, and
        center multiline labels.  (#318763, Ross Burton)

        * gtk/gtkcellrenderertext.c (get_layout): Remove a special
        case for single-line layouts.

ChangeLog
gtk/gtkcellrenderertext.c
gtk/gtkiconview.c

index 2f1a4d54ada8fdb9d34eb2cd7c1b4d516e6cef1e..c46c786f05a92c776002efac7bc930a546cd0dea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-12-28  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkiconview.c: Use word wrapping by default, and
+       center multiline labels.  (#318763, Ross Burton)
+
+       * gtk/gtkcellrenderertext.c (get_layout): Remove a special
+       case for single-line layouts.
+
 2006-12-28  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkarrow.c: Fix a typo in the docs.  (#390423,
index 0b8de55d24f3492d75b48ca8b6c29f9a271f6948..e703903119c68ce41e7b72d1c5dfc2610d605a3f 100644 (file)
@@ -1445,12 +1445,6 @@ get_layout (GtkCellRendererText *celltext,
     {
       pango_layout_set_width (layout, priv->wrap_width * PANGO_SCALE);
       pango_layout_set_wrap (layout, priv->wrap_mode);
-
-      if (pango_layout_get_line_count (layout) == 1)
-       {
-         pango_layout_set_width (layout, -1);
-         pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
-       }
     }
   else
     {
index 4b028fc4e09ea41e5eede70b0e7fb8a0bf6e6ceb..218e653f930839db4bf1398549499c580a6dd5f6 100644 (file)
@@ -2659,6 +2659,7 @@ adjust_wrap_width (GtkIconView     *icon_view,
        wrap_width = item->width - pixbuf_width - icon_view->priv->spacing;
 
       g_object_set (text_info->cell, "wrap-width", wrap_width, NULL);
+      g_object_set (text_info->cell, "width", wrap_width, NULL);
     }
 }
 
@@ -4150,7 +4151,8 @@ gtk_icon_view_set_cell_data (GtkIconView     *icon_view,
       GtkTreePath *path;
 
       path = gtk_tree_path_new_from_indices (item->index, -1);
-      gtk_tree_model_get_iter (icon_view->priv->model, &iter, path);
+      if (!gtk_tree_model_get_iter (icon_view->priv->model, &iter, path))
+        return;
       gtk_tree_path_free (path);
     }
   else
@@ -4826,14 +4828,16 @@ update_text_cell (GtkIconView *icon_view)
 
       if (icon_view->priv->orientation == GTK_ORIENTATION_VERTICAL)
        g_object_set (info->cell,
-                     "wrap-mode", PANGO_WRAP_CHAR,
+                      "alignment", PANGO_ALIGN_CENTER,
+                     "wrap-mode", PANGO_WRAP_WORD,
                      "wrap-width", icon_view->priv->item_width,
-                     "xalign", 0.5,
+                     "xalign", 0.0,
                      "yalign", 0.0,
                      NULL);
       else
        g_object_set (info->cell,
-                     "wrap-mode", PANGO_WRAP_CHAR,
+                      "alignment", PANGO_ALIGN_LEFT,
+                     "wrap-mode", PANGO_WRAP_WORD,
                      "wrap-width", icon_view->priv->item_width,
                      "xalign", 0.0,
                      "yalign", 0.0,
@@ -8852,10 +8856,10 @@ static AtkObject*
 gtk_icon_view_accessible_ref_selection (AtkSelection *selection,
                                         gint          i)
 {
+  GList *l;
   GtkWidget *widget;
   GtkIconView *icon_view;
   GtkIconViewItem *item;
-  GList *l;
 
   widget = GTK_ACCESSIBLE (selection)->widget;
   if (widget == NULL)